package org.example.medical.entity;

import lombok.Data;

import java.time.LocalDate;

@Data
public class AdmissionRecord {
    private Long recordId;
    private Integer patientId;
    private LocalDate admissionDate;
    private LocalDate dischargeDate;
    private Integer retainedDays;
    private String patientName; // 患者姓名
    private Integer isDeleted; // 逻辑删除标志

    // Getters and Setters
    public Long getRecordId() {
        return recordId;
    }

    public void setRecordId(Long recordId) {
        this.recordId = recordId;
    }

    public Integer getPatientId() {
        return patientId;
    }

    public void setPatientId(Integer patientId) {
        this.patientId = patientId;
    }

    public LocalDate getAdmissionDate() {
        return admissionDate;
    }

    public void setAdmissionDate(LocalDate admissionDate) {
        this.admissionDate = admissionDate;
    }

    public LocalDate getDischargeDate() {
        return dischargeDate;
    }

    public void setDischargeDate(LocalDate dischargeDate) {
        this.dischargeDate = dischargeDate;
    }

    public Integer getRetainedDays() {
        if (admissionDate != null && dischargeDate != null) {
            return (int) java.time.temporal.ChronoUnit.DAYS.between(admissionDate, dischargeDate);
        }
        return retainedDays;
    }

    public void setRetainedDays(Integer retainedDays) {
        this.retainedDays = retainedDays;
    }

    public String getPatientName() {
        return patientName;
    }

    public void setPatientName(String patientName) {
        this.patientName = patientName;
    }

    public Integer getIsDeleted() {
        return isDeleted;
    }

    public void setIsDeleted(Integer isDeleted) {
        this.isDeleted = isDeleted;
    }
}